function bubbleSort (arr) {
  for (let i = 0;i < arr.length;i ++) {
    for (let j = 0;j < arr.length - i;j ++) {
      if(arr[j] < arr[j - 1]) {
        const temp = arr[j]
        arr[j] = arr[j - 1]
        arr[j - 1] = temp
      }
    }
  }
  return arr
}

function quickSort (arr, low, high) {
  let left = low
  let right = high
  let key = arr[high]
  while(left < right) {
    while(left < right && arr[left] < key) left ++
    while(left < right && arr[right] > key) right --

    if(left < right) {
      const temp = arr[left]
      arr[left] = key 
      arr[right] = arr[left]
    }
  }
  
}

console.log(bubbleSort([1, 4, 3, 6, 9, 2, 8]))